package com.Imp;

import com.entity.Cart;
import com.entity.Hire;
import com.mapper.HireMapper;
import com.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HireMapperImpl implements HireMapper {
    public List<Hire> getHireByStoreId(String storeId){
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        return sqlSession.selectList("com.mapper.HireMapper.getHireByStoreId",storeId);
    }

    public List<Hire> getHireByDeliveryId(String deliveryId){
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        return sqlSession.selectList("com.mapper.HireMapper.getHireByDeliveryId",deliveryId);
    }

    public void deleteHire(Hire hire){
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        sqlSession.delete("com.mapper.HireMapper.deleteHire", hire);
        sqlSession.commit();  // 提交事务
    }
    public void addToHire(Hire hire) {
        SqlSession sqlSession = MyBatisUtil.openSqlSession();
        sqlSession.insert("com.mapper.HireMapper.addToHire",hire);
        sqlSession.commit();  // 提交事务
    }

}
